package cn.itsource.hrm.service.impl;

import cn.itsource.hrm.domain.Systemdictionary;
import cn.itsource.hrm.domain.Systemdictionaryitem;
import cn.itsource.hrm.mapper.SystemdictionaryMapper;
import cn.itsource.hrm.mapper.SystemdictionaryitemMapper;
import cn.itsource.hrm.service.ISystemdictionaryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenyuqi
 * @since 2020-05-19
 */
@Service
public class SystemdictionaryServiceImpl extends ServiceImpl<SystemdictionaryMapper, Systemdictionary> implements ISystemdictionaryService {
    private final String COURSE_GRADES ="courseLevel";
    @Autowired
    private SystemdictionaryitemMapper systemdictionaryitemMapper;
    @Override
    public List<Systemdictionaryitem> getGrades() {
        Systemdictionary systemdictionary = baseMapper.selectOne(new QueryWrapper<Systemdictionary>().eq("sn", COURSE_GRADES));
        return systemdictionaryitemMapper.selectList(new QueryWrapper<Systemdictionaryitem>().eq("parent_id",systemdictionary.getId()));

    }
}
